Indicator is the alpha-numeric one-row window where you can put data or
character strings. But there is a difference between Indicator and
a real window (such as an Outbox). When you declare Indicator you must
specify the format of the data output and this restricts you on what
you can put on Indicator. On the other hand this simplifies the
subsequent programming. In most of cases indicator is used to display
only one variable, e.g. temperature or voltage. It is reasonable to
attach this variable to Indicator. We defined Indicator as the
template class with one type parameter T - the type of the attached
variable.
Constructor:
The format parameter is the string analogous to that used in the
standard printf function. The frame parameter is reasonable to change
to FRAMED when you use POPUP or PERM type of Indicator, and leave
UNFRAMED when you use FIXED type, because FIXED type Indicator is
usually embedded in the board or panel. You have to keep in mind that
changing the default data font will slow down the overall performance,
because displaying the vector fonts takes excessive time. The
indcolcnfg defines the color scheme. There are four pre-defined color
schemes for Indicator:
LEDind - red light-emitting diodes,
LUMind - green cathode-ray display,
LCDdark - liquid crystal display,
LCDbright - back-lit liquid crystal display.
Example:
Indicator<float> *pindTemp = new Indicator<float> (0,0,FIXED,"Temperature", 10, // width of disp. in chars &Temp,"%.2f K", // variable and format, temperature in Kelvin UNFRAMED,procDummy, // no paint proc. defined 0,1, // font and size of number SMALL_FONT,4); // font and size of title
Unframed indicator pindTemp is initialized at the left top corner of the screen. Later in the program, when the true location of pindTemp will be calculated, you can use MovetoXY method, inherited from the object base class, to relocate pindTemp before painting.
If you don't want to attach any variable to the indicator you can use
class _Indicator (it is not a template class). Then in the constructor
you must omit the parameter variable and you cannot use Refresh
method.
Data members:
All are inherited from the object base class (sect.4).
Methods:
Includes methods inherited from the object base class (sect.4).
Clears display. Inherited from display class.
Paints the indicator and clears its display.
Clears the display and puts the value of the attached variable in
accordance
with the format defined in the constructor.
Puts data on the display in accordance with the format defined in
the constructor. You may consider it is as pritnf( format, ...).
Example:
\hspace{2cm} pindTemp->Put( 77.2); or \hspace{2cm} Temp=77.2; pindTemp->Refresh();Here pindTemp is declared in the preceding example. After the execution of one of these fragments the indicator will display: " 77.2 K".
Puts string str on the indicator. This method doesn't use format. So
you can display on the indicator any message that fits the width of
indicator.
Example:
pindTemp->Puts( "Overflow");Color schemes:
Color pattern for Indicator is provided by the structure:
There are four pre-defined color schemes for Indicator:
LEDind, LUMind, LCDdark, LCDbright.